/*
 * SocketWrite.h
 *
 *  Created on: Dec 21, 2011
 *      Author: dzm
 */
#include <iostream>
#include <QHostAddress>
#include <QString>
#include <QTcpSocket>

#include "Node.h"
#include "Packet.h"

#ifndef SOCKETWRITE_H_
#define SOCKETWRITE_H_

class SocketWrite : public QObject
{
	Q_OBJECT

public:
	SocketWrite();
	virtual ~SocketWrite();

	bool deliverPacket(Node & next, Packet & p , int outport);
	bool deliverPacket(Node & next, Packet & p , int outport, QTcpSocket *inSocket);
//PL---//根据坐标转换成IP
	QHostAddress coordinaryToip(QString s);
	QString getRemoteIP(Node & next);
	int getRemotePort(int outport, Node &next);

	QTcpSocket *sendSocket;
};

#endif /* SOCKETWRITE_H_ */
